<template>
    <transition name='bounceRight' >
        <li class='article'>
            <div class='article-inner'>
                <router-link :to="goDeatil" class="detail">
                    <span class='title' >{{data.title}}</span>
                </router-link>
                <span class='date fa fa-calendar'>{{data.date|FormatDate}}</span>
                <!-- <div class='content language-markdown' v-html='compiledMarkdown' ></div> -->
            </div>
            <div class='article-tips' >
                <i class='fa fa-leaf yezi'></i>
                <a href="javascript:void(0)" v-for='(i,index) in tips.tips' :key='i' class='tips' :style='tips.color[index]' @click="allArticle('Tips-article-' + i)">
                    {{i}}
                </a>
                <router-link :to="goDeatil" class="detail">more >></router-link>
            </div>
        </li>
    </transition>
</template>
<script>
import {FormatDate} from '@/unit/fmt'
// import 'vue2-animate/dist/vue2-animate.min.css'
export default {
  name: 'rightmain-li',
  data () {
    return {
      data: {}
    }
  },
  mounted () {
    this.data = this.$attrs.data
    // console.log(Prism)
  },
  computed: {
    goDeatil () {
      return '/detail/' + this.data.aid + '/' + this.data.title
    },
    tips () {
      if (this.data.aid === undefined) {
        return ''
      }
      let tips = this.$attrs.data.tips.split(',')
      let color = this.$attrs.data.color.split(',')
      return {tips, color}
    },
    compiledMarkdown: function () {
      let md = this.marked(this.$attrs.data.intro || '', { sanitize: true })
      return md
    }
  },
  methods: {
    allArticle (arg) {
      this.$store.dispatch('setRigthPage', arg)
    }
  },
  filters: {
    FormatDate
  }
}
</script>
<style scoped lang='less'>
.article {
    background: #FFF;
    padding-left: 3.5rem;
    padding-right: 5rem;
    /* min-height: 9rem; */
}
.article-inner {
    position: relative;
}
.article .article-inner {
    min-height: inherit;
}
.article-tips {
    /* border-top: 0.1rem solid #bbb; */
    margin: 0 0 2rem;
    padding: 1.5rem 0 2rem;
}
.title {
    font-size: 2rem;
    font-weight: 300;
    color: #666;
    /* margin-top: 2rem; */
    display: inline-block;
    font-weight: bold;
    width: 100%;
    height: 86px;
    box-sizing: border-box;
    margin-top: 0;
    padding-top: 2rem;
    border-bottom: 1px dashed #000;
}
.title:hover {
    color: #7b5d5f;
    border-bottom: 2px solid #7b5d5f;
}
.article::before {
    content: '';
    position: absolute;
    left: 0;
    border: 3px solid #7b5d5f;
    height: 80px;
}
.date {
    position: absolute;
    right: 1rem;
    top: 4rem;
    color: #aaa;
    font-size: 1.2rem;
    font-weight: bold;
}
.content{
    font-size: 1.3rem;
    font-weight: 300;
    color: #666;
    padding-top: 1.5rem;
}
.article-tips .detail {
    float: right;
    background: #4d4d4d;
    color: #fff;
    font-size: 12px;
    padding: 2px 8px 4px;
    line-height: 16px;
    -webkit-border-radius: 2px;
    -moz-border-radius: 2px;
    -webkit-border-radius: 2px;
    border-radius: 2px;
    -webkit-transition: background 0.3s;
    -moz-transition: background 0.3s;
    -ms-transition: background 0.3s;
    transition: background 0.3s;
    margin-top: -6px;
}
.article-tips .tips:before {
    content: " ";
    width: 0px;
    height: 0px;
    position: absolute;
    top: 0;
    left: -10px;
    border: 9px solid #fff;
    border-right-color: transparent;
}
.article-tips .tips:after {
    content: " ";
    width: 4px;
    height: 4px;
    background-color: #fff;
    -webkit-border-radius: 4px;
    border-radius: 4px;
    -webkit-box-shadow: 0px 0px 0px 1px rgba(0,0,0,0.3);
    box-shadow: 0px 0px 0px 1px rgba(0,0,0,0.3);
    position: absolute;
    top: 7px;
    left: 10px;
}
.article-tips .tips {
    display: inline-block;
    text-decoration: none;
    font-weight: normal;
    font-size: 12px;
    color: #fff;
    height: 18px;
    line-height: 18px;
    background: #ddd;
    float: left;
    padding: 0 5px 0px 20px;
    position: relative;
    left: 5px;
    -webkit-border-radius: 0 5px 5px 0;
    border-radius: 0 5px 5px 0;
    margin: 5px 9px 5px 8px;
    font-family: monaco, menlo, consolas, 'courier new', courier, monospace;
    margin-top: -6px;
}
.fa-calendar {
    color: #666;
    font-weight: 100;
}
.fa-leaf {
    color: #adaaaa;
    font-weight: 100;
    margin-right: -8px;
    font-size: 18px;
}
.yezi {
    float: left;
    z-index: 999999;
    margin-top: -6px;
    position: relative;
}
@media screen and (max-width: 800px) {
    .article {
        padding-left: 1.5rem;
        padding-right: 1rem;
    }
    .title {
       font-size: 1.5rem;
    }
    .date {
        display: none;
    }
    .article-tips {
        display: flex;
        flex-wrap: wrap;
    }
    .date,
    .article-tips .tips,
    .article-tips i {
        display: none;
    }
    .article-tips .detail {
        width: 100%;
        background: #7f5b5d;
        text-align: center;
    }

}
</style>
